package com.cheyunkeji.er.view.evaluate;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.ImageView;

/**
 * 用于绘制多个Bitmap的ImageView
 */
public class DrawBitmapsImageView extends ImageView {

    private static final String TAG = DrawBitmapsImageView.class.getSimpleName();

    private Bitmap[] mDrawables;

    public DrawBitmapsImageView(Context context, AttributeSet attrs) {
        super(context, attrs);

    }

    public void setBitmaps(Bitmap[] bitmap) {
        this.mDrawables = bitmap;
        invalidate();
    }


    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if (mDrawables != null && mDrawables.length > 0) {
            for (int i = 0; i < mDrawables.length; i++) {
                RectF rectF = new RectF(0, 0, getWidth(), getHeight());
                canvas.drawBitmap(mDrawables[i], null, rectF, null);
            }
        }
    }

}
